package com.hemj.fileInfo.controller;

import com.hemj.common.core.domain.R;
import com.hemj.fileInfo.bo.FileInfoBo;
import com.hemj.fileInfo.vo.FileInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import com.github.pagehelper.Page;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hemj.common.annotation.Log;
import com.hemj.common.core.controller.BaseController;
import com.hemj.common.core.domain.AjaxResult;
import com.hemj.common.enums.BusinessType;
import com.hemj.fileInfo.domain.FileRole;
import com.hemj.fileInfo.vo.FileRoleVo;
import com.hemj.fileInfo.bo.FileRoleBo;
import com.hemj.fileInfo.service.impl.FileRoleServiceImpl;
import com.hemj.common.utils.poi.ExcelUtil;
import com.hemj.common.core.page.TableDataInfo;

/**
 * 文件和用户的关联Controller
 * 
 * @author hemj
 * @date 2024-09-13
 */
@Api(tags = "文件和用户的关联接口")
@RestController
@RequestMapping("/fileInfo/fileRole")
public class FileRoleController extends BaseController
{
    @Autowired
    private FileRoleServiceImpl fileRoleService;

    /**
     * 分页查询文件
     */
    @Log(title = "文件权限", businessType = BusinessType.UPDATE)
    @PostMapping("/saveRole")
    public R saveRole(@RequestBody FileRoleVo fileRoleVo)
    {
        fileRoleService.saveBatch(fileRoleVo);
        return R.ok();
    }

    /**
     * 分页查询文件
     */
    @PostMapping("/getRole")
    public R<List<FileRole>> getRole(@RequestBody FileRoleVo fileRoleVo)
    {
        return R.ok(fileRoleService.getRole(fileRoleVo));
    }

    /**
     * 分页查询文件
     */
    @PostMapping("/getMyRole")
    public R<List<FileRole>> getMyRole()
    {
        return R.ok(fileRoleService.getMyRole());
    }

}
